package com.hu.web.dao.impl;

import com.hu.web.dao.BaseDaoImpl;
import com.hu.web.dao.UserDao;
import com.hu.web.entity.User;

public class UserDaoImpl extends BaseDaoImpl implements UserDao {

    @Override
    public User findUserByUsername(String username) {
        String sql = "select * from t_user where username = ?";
        return this.getBean(User.class, sql, username);
    }

    @Override
    public Boolean addUser(User user) {
        String sql = "insert into t_user values(null,?,?,?)";
        int update = this.update(sql, user.getUsername(), user.getPassword(), user.getEmail());
        return update > 0;
    }

}
